package com.example.demo.huawei;

import java.util.*;

/**
 * 变换最小字符串
 */
public class OD33 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        // 找到最小的字符

        char[] array = s.toCharArray();
        List<String> list = new ArrayList<>();
        list.add(new String(array));
        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                char[] tempArray = Arrays.copyOf(array, array.length);
                char temp = tempArray[i];
                tempArray[i] = tempArray[j];
                tempArray[j] = temp;
                list.add(new String(tempArray));
            }
        }
        Collections.sort(list);
//        System.out.println(list.get(0));
        System.out.println(list);

    }
}
